#
# @lc app=leetcode.cn id=26 lang=python3
#
# [26] 删除有序数组中的重复项
#

# @lc code=start
class Solution:
    def removeDuplicates(self, nums: List[int]) -> int:
        slowIndex, fastIndex = 1, 1
        n = len(nums)
        if n == 1: return 1

        while fastIndex < n:
            if nums[fastIndex] != nums[fastIndex-1]:
                nums[slowIndex] = nums[fastIndex]
                slowIndex += 1
            fastIndex += 1

        return slowIndex
# @lc code=end

